//原理computed 用于返回最新的数据值 {计算属性写法}
var getters = {
	counts(state){
		return 'hello'+state.count
	},
	countCar(state) {//购物车数量
	    if (state.carListInfo.length >= 1) {
	        let sum = 0;
	        state.carListInfo.forEach(v => {
	            sum += v.quantity
	        })
	        return sum;
	    }
	},
	OderList(state) {//订单总价
	    if (state.oderInfo!=null) {
	        let sum = 0;
	        state.oderInfo.forEach(item => {
	            sum += item.product.price * item.quantity
	        })
	        return sum;
	    }
	
	},
	
	countOder(state) {
	    if (state.oderInfo.length >= 1) {
	        let oder = 0;
	        state.oderInfo.forEach(v => {
	            oder += v.product.price * v.quantity
	        })
	        return oder;
	    }
	
	},
	
}

export default getters;